<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="app">
      <input v-model.number="number" type="number" step="20" />
      <p>{{animatedNumber}}</p>
    </div>
    <script src="https://cdn.bootcdn.net/ajax/libs/vue/2.6.9/vue.min.js"></script>
    <script src="https://cdn.bootcdn.net/ajax/libs/gsap/3.2.4/gsap.min.js"></script>

    <script>
      new Vue({
        el: "#app",
        data: {
          number: 0,
          tweenedNumber: 0,
        },
        computed: {
          animatedNumber: function () {
            return this.tweenedNumber.toFixed(0);
          },
        },
        watch: {
          number: function (newVal) {
            gsap.to(this.$data, { duration: 0.5, tweenedNumber: newVal });
          },
        },
      });
    </script>
  </body>
</html>
